import os, sys
import MySQLdb
from Tools.scripts.make_ctype import values

try:
    conn=MySQLdb.connect(host="localhost",user="root",passwd="",db="address"
except Exception as e:
    print( e)
    sys.exit()
cursor=conn.cursor()
sql="insert into address(name, address) values(%s, %s)"
value=(("zhangsan","haidian"),("lisi","haidian"))
try:
    cursor.executemany(sql,values)
except Exception as e:
    print (e)
sql="select * from address"
cursor.execute(sql)
data=cursor.fetchall()
if data:
    for x in data:
        print (x[0],x[1])
cursor.close()
conn.close()